package calorie.com.calorie.contact;

import android.content.Context;

import com.lxh.baselibray.mvp.BasePresent;
import com.lxh.baselibray.mvp.IBaseView;
import com.lxh.baselibray.net.NetCallBack;
import com.lxh.baselibray.net.ServiceGenerator;

import calorie.com.calorie.api.ApiService;
import calorie.com.calorie.request.CancelOrderRequest;
import calorie.com.calorie.request.SureOrderRequest;
import calorie.com.calorie.response.CancelOrderResponce;
import calorie.com.calorie.response.SureOrderResponce;
import retrofit2.Call;
import retrofit2.Response;

/**
 * Created by chenxi on 2019/4/11.
 */

public class SureOrderContact {
    public static class SureOrderPresent extends BasePresent<SureOrderContact.ISureOrderView> {
        public void sureOrders(final Context context, String orderId, Integer userId, String dealPassword){
            ApiService service = ServiceGenerator.createService(ApiService.class);
            SureOrderRequest request = new SureOrderRequest(orderId,userId,dealPassword);
            service.sureOrders(request).enqueue(new NetCallBack<SureOrderResponce>() {
                @Override
                public void onSuccess(Call<SureOrderResponce> call, Response<SureOrderResponce> response) {
                    if(getView()!= null){
                        getView().getSureOrderResult(response);
                    }
                }

                @Override
                public void onFailed() {

                }
            });
        }
    }

    public interface ISureOrderView extends IBaseView {
        void getSureOrderResult(Response<SureOrderResponce> response);
    }
}
